//
//  Polygon.h
//  Coffee
//
//  Created by sabhanayagam b on 5/27/11.
//  Copyright 2011 Cognizant. All rights reserved.
//

#import <Foundation/Foundation.h>
#import "Vector2D.h"
#import "CollisionResponse.h"

@interface Polygon : NSObject {

	CGPoint center;
	CGPoint _center;

	CGPoint offset;
	CGSize size;
	
	Vector2D *edge;
	CollisionResponse *collisionResponse;
	int count;

	CGPoint *points;
	CGPoint *initialPoints;

	NSMutableArray *axes;
	
	Vector2D *objectDiff;
	
	float dotProduct;
	
}

@property (nonatomic , assign) CGPoint *points;
@property (nonatomic , assign) CGPoint *initialPoints;

@property (nonatomic , retain) NSArray  *axes;

@property (nonatomic , retain) CollisionResponse  *collisionResponse;

@property (nonatomic , retain) Vector2D *edge;
@property (nonatomic , retain) Vector2D *objectDiff;

@property CGPoint center , offset , _center;
@property CGSize size;
@property float dotProduct;
@property(readonly) int count;


-(id) initWithvertices:(CGPoint*)pts count:(int)cnt size:(CGSize)wd;
-(void) defineCenter;
-(void) defineAxes;
-(void) defineSize;
-(void) restInPeace;


-(void) translateVelocity:(Vector2D*)velocity;
//Collision
-(BOOL) isCollidingWith:(Polygon*)polygon translationVector:(Vector2D*)translationVector;
-(CollisionResponse*) invokeCollisionResponse:(Polygon*)polygon;
-(float) getAxisOverlap:(Polygon*)polygon Axis:(Vector2D*)axis;


@end
